<?php use_helper('Javascript') ?>
<script type="text/javascript">

function OnCustomerSaveClicked()
{
    jQuery.ajax({
        type: 'POST',
        url: '/public_html/test.php/user/save',
        data: jQuery('#sf_admin_edit_form').serialize(),
        success: function(data){
            jQuery('#modalin').html(data);
            jQuery('#user_select').load('/public_html/test.php/calendar/calendar');
            jQuery('#vendor_select').load('/public_html/test.php/calendar/calendar');
        },
        dataType: "html"
    });
}

function OnCreateCustomerClicked()
{
    jQuery('#modal').show();
    jQuery('#modalin').load('/public_html/test.php/user/create');
}
function OnCreateVendorClicked()
{
    jQuery('#modal').show();
    jQuery('#modalin').load('/public_html/test.php/user/create');
}
</script>

<div id="modal" style="border:3px solid black; background-color:#9999ff; padding:25px; font-size:150%; text-align:center; display:none;">
    <div id="modalin">
        
        </div>

    <?php echo  link_to('save', '#', array('onclick' => 'OnCustomerSaveClicked()'));?>
    <input type="button" value="Close" onClick="jQuery('#modal').hide();">
</div>
<div id="user_select"></div>
<div id="vendor_select"></div>
<a href="#" onclick="OnCreateCustomerClicked();return false;">create user</a>
<br>
<a href="#" onclick="OnCreateVendorClicked();return false;">create vendor</a>